#提款系统界面的输出
banklist=[
	{'name':'mr.niu','balance':2000,'key':'123456'}]

def showbalance(banklist):
	print('{}'.format("余额：",end=''))
	for i in range(len(banklist)):
		print('{0:<10} {1:<7}'.format(banklist[i]['name'],banklist[i]['balance']))

 	
print("="*13,"自动存取款机","="*13)
names=input("请输入用户名：") 
keys=input("请输入密码：")
if names!="" or keys!="":
	for yzdl in banklist:
		if yzdl['name']==names and  yzdl['key']==keys:
			while True:
				print("{0} {1} {2}".format(" ","1.查询余额","2.取款"))
				print("{0} {1} {2}".format(" ","3.存款","4.退卡"))
				print("="*40)
				xuze=input("请输入相应的选择：")
				if xuze=="1":
					print('='*13,"余额","="*13)
					showbalance(banklist)
					input("按回车键继续：")
				elif xuze=="2":
					print('='*13,"取款","="*13)
					qukuan=input("请输入取款金额：")
					qukuan=int(qukuan)
					for i in range(len(banklist)):
						if banklist[i]["balance"]-qukuan>=0:
							banklist[i]["balance"]-=qukuan
							print("取款成功！")
						else:
							print("余额不足！")
					showbalance(banklist)
					input("按回车键继续：")
				elif xuze=="3":
					print('='*13,"存款","="*13)
					cun=input("请输入存款金额：")
					cun=int(cun)
					for i in range(len(banklist)):
						banklist[i]["balance"]+=cun
						print("存款成功！")
					showbalance(banklist)
					input("按回车键继续：")
				elif xuze=="4":
					print('='*4,"欢迎下次再来，祝您生活愉快！","="*4)
					break
				else:
					print('='*13,"输入无效！","="*15)
		else:
			print("输入密码有误！")
